// src/route/Router.tsx
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
import HomePage from '../page/HomePage'
import DashboardPage from '../page/DashboardPage'
import ProductPage from '../page/ProductPage'
import UserPage from '../page/UserPage'
import AuthorityPage from '../page/AuthorityPage'
import CustomerServicePage from '../page/CustomerServicePage'
import AdvertisementPage from '../page/AdvertisementPage' // 添加导入
import LoginPage from '../page/LoginPage'
import ProtectedRoute from "./ProtectedRoute"

export const AppRoutes = () => {
    return (
        <Router basename="/admin">
            <Routes>
                <Route path="/login" element={<LoginPage />} />
                <Route
                    path="/"
                    element={
                        <ProtectedRoute>
                            <HomePage />
                        </ProtectedRoute>
                    }
                >
                    <Route path="dashboard" element={<DashboardPage />} />
                    <Route path="products" element={<ProductPage />} />
                    <Route path="users" element={<UserPage />} />
                    <Route path="permissions" element={<AuthorityPage />} />
                    <Route path="customer-service" element={<CustomerServicePage />} />
                    <Route path="advertisements" element={<AdvertisementPage />} /> {/* 添加广告管理路由 */}
                </Route>
            </Routes>
        </Router>
    )
}


